// 友元类
#include <iostream>
#include <string>
using namespace std;
class Building;
class GoodFriend {
private:
public:
    Building* building;
    GoodFriend();
    void visit();

};
class Building {
    // GoodFriend是友元类，可以访问本类中的私有属性
    friend class GoodFriend;
private:
    string m_bedRoom;
public:
    string m_sittingRoom;
    Building();
};
// 类内声明，类外实现
GoodFriend::GoodFriend() {
    building = new Building;
}
void GoodFriend::visit() {
    cout << "GoodFriend is visiting Building sittingRoom: " << building->m_sittingRoom << endl;
    cout << "GoodFriend is visiting Building bedRoom: " << building->m_bedRoom << endl;
}
Building::Building() {
    m_bedRoom = "bedRoom";
    m_sittingRoom = "sittingRoom";
}
void test1() {
    GoodFriend gf;
    gf.visit();
}
int main(void) {
    test1();

    return 0;
}